import java.sql.*;
public class jdbcConnection {
    Connection connection;
    public jdbcConnection() {
        Connection conn = null;
        try {
            try {
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
            } catch (SQLException e) {
                e.printStackTrace();
            }
            String url = "jdbc:mysql://120.25.152.50:3306/学生成绩管理系统";
            String user = "root";   //这里的信息是需要更改的
            String password = "zqy939597A";
            conn = DriverManager.getConnection(url, user, password);
            System.out.println("数据库连接对象" + conn);
            connection= conn;

        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    public Connection giveConnection(){
        return connection;
    }
}

